package flyweight;

import java.util.HashMap;
import java.util.Map;

/**
 * @author : DuJiabao
 * @Date : 2021/3/3 23:04
 * @Project : design-pattern
 * @File : null.java
 * @Desc :
 */
public class ChessBoard {
  private Map<Integer, ChessPiece> chessPieces = new HashMap<>();

  public ChessBoard() {
    init();  // 初始化棋子位置坐标
  }

  private void init() {
    chessPieces.put(1, new ChessPiece(ChessPieceUnitFactory.getChessPiece(1), 0, 0));
    chessPieces.put(1, new ChessPiece(ChessPieceUnitFactory.getChessPiece(2), 1, 0));
    //...省略摆放其他棋子的代码...
  }

  public void move(int chessPieceId, int toPositionX, int toPositionY) {
    //...省略...
  }
}



